package top.broncho.lottery.util

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import androidx.databinding.DataBindingComponent

/**
 * DataBinding 的拓展适配器
 */
class DataBindingExpandUtils {

    companion object {

        /**
         * 本地图片加载
         */
        @BindingAdapter("image_path")
        fun loadLocalImage(view: ImageView, path: String?) {
            view.loadLocalImage(path ?: "")
        }

    }
}

/**
 * 加载 DataBinding 的拓展适配器
 */
class LotteryDataBindingComponent : DataBindingComponent {
    override fun getCompanion(): DataBindingExpandUtils.Companion = DataBindingExpandUtils
}